package demo3;

public class Test
{
    public static void main(String[] args)
            throws CloneNotSupportedException
    {
        Person person1=new Person("zhangsan",20);

        Person person2=(Person) person1.clone();
//        System.out.println(person2);
        System.out.println(person1.m.money);
        System.out.println(person2.m.money);

        person2.m.money=99.99;
        //浅拷贝
        //只克隆了Person对象，没有克隆Money对象
        System.out.println(person1.m.money);
        System.out.println(person2.m.money);
    }


}
